var webpack = require("webpack");
var path = require("path");
var proxy = require("http-proxy-middleware");

module.exports = {
    entry:'./index.js',
    output:{
        publicPath:'',
        filename:'bundle.js'
    },
    module:{
        loaders:[
            {
                test:/\.js$/,
                exclude:/node_modules/,
                loader:'babel-loader?presets[]=es2015&presets[]=react'
            },
            {
                test: /\.scss?$/,
                loader: 'style-loader!css-loader!sass-loader',
            },
        ]
    },
    devServer:{
        proxy:{
            '/api':{
                target:'http://api.douban.com',     //设置的是代理对象地址
                pathRewrite:{'^/api':'/'},          //重定路径
                changeOrigin:true
            }
            // http://api.douban.com/v2/movie/top250 --> api/v2/movie/top250
        }
    }
    
}